<template>
    <el-row :gutter="20">
      <el-col :span="8">
        <el-form-item label="供应商：">
          <el-select placeholder="请选择" clearable>
            <el-option label="启用" :value="true" />
            <el-option label="禁用" :value="false" />
          </el-select>
        </el-form-item>
      </el-col>
      <el-col :span="8" >
        <el-form-item label="单据日期：">
          <el-date-picker
            v-model="defaultTime"
            type="datetime"
            placeholder="请选择日期"
          />
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="单据编号：">
          <el-input v-model="defaultNum" placeholder="请输入单据编号" />
        </el-form-item>
      </el-col>
    </el-row>

    <div>
      <el-button type="primary" :icon="Plus" @click="addRow" >插入行</el-button>
      <el-button type="primary" :icon="Minus" @click="addRow" >移除行</el-button>
      <el-button>扫码录入</el-button>
      <el-button>导入明细</el-button>
    </div>
    <div>
      <ul style="overflow: auto;height:25vh;width:90%" >
        <table style="color: black">
          <thead>
            <tr>
              <td><input type="checkbox" /></td>
              <td>仓库名称</td>
              <td>条码</td>
              <td>名称</td>
              <td>规格</td>
              <td>库存</td>
              <td>单位</td>
              <td>数量</td>
              <td>单价</td>
              <td>金额</td>
              <td>备注</td>
            </tr>
          </thead>
          <tbody>
            <tr v-for="(item, index) in tableData" :key="index">
              <td>
                <input type="checkbox" />
              </td>
              <td>
                <el-input placeholder="请输入条码"/>
              </td>
              <td>
                <el-input placeholder="请输入单位"/>
              </td>
              <td>
                <el-input placeholder="请输入采购价"/>
              </td>
              <td>
                <el-input placeholder="请输入销售价"/>
              </td>
              <td>
                <el-input placeholder="请输入最低售价"/>
              </td>
              <td>
                <el-input placeholder="请输入最低售价"/>
              </td>
              <td>
                <el-input placeholder="请输入最低售价"/>
              </td>
              <td>
                <el-input placeholder="请输入最低售价"/>
              </td>
              <td>
                <el-input placeholder="请输入最低售价"/>
              </td>
              <td>
                <el-input placeholder="请输入最低售价"/>
              </td>
            </tr>
            <tr>
              <td></td>
              <td></td>
              <td></td>
              <td></td>
              <td></td>
              <td></td>
              <td></td>
              <td>总数量</td>
              <td></td>
              <td>总价</td>
              <td></td>
            </tr>
          </tbody>
        </table>
      </ul>
    </div>
    <div>
      <el-input autosize type="textarea" placeholder="请输入备注"/>
    </div>
</template>

<script lang="ts" setup>
import {reactive,ref,onMounted} from 'vue'
import {useRoute,useRouter} from 'vue-router'
import {ElMessage,ElMessageBox} from 'element-plus'
import moment from 'moment';

const router=useRouter()
const route=useRoute()
import {  Minus, Plus } from '@element-plus/icons-vue';
const defaultTime = ref(new Date())
const defaultNum=ref('')
const tableData = ref([{}]);
const addRow = () => {
  tableData.value.push({});
};

onMounted(()=>{
  defaultNum.value='SX'+ moment().format('YYYYMMDDHHmmssSSS');
})
</script>

<style scoped>
.el-row {
  margin-bottom: 20px;
}
.el-row:last-child {
  margin-bottom: 0;
}
.el-col {
  border-radius: 4px;
}

.grid-content {
  border-radius: 4px;
  min-height: 36px;
}

</style>